<!-- newsletter -->

    <div class="container" id="newsLetter">
          <div class="row">
                <div class="col-sm-2">
                  <h4 class="title">JOIN OUR <br>NEWSLETTER</h4>
                 </div>
                <div class="col-sm-6">
                    <form id="subscribe" name="subscribe" >
                        <div class="col-sm-10">
                            <input type="text" class="form-control input-sm" placeholder="
                            <?php echo($text_subscribe); ?>" size="60" name="subscribe_email" id="subscribe_email">
                        </div>
                        <div class="col-sm-2">
                            <input type="hidden" value="" name="subscribe_name" id="subscribe_name">
                        </div>
                        <div class="col-sm-2">
                          <a onclick="email_subscribe();" class="btn btn-purple">Register</a>
                        </div>
                    </form>
                </div>
                <div class="col-sm-2">
                  <h4 class="title">..OR FOLLOW US ON</h4>
                 </div>
                <div class="col-sm-2 text-right">
                  <a href ="#"><img width="38" height="38" src="catalog/view/theme/mbe/images/facebook.png"></a>
                  <a href="#"><img width="38" height="38" src="catalog/view/theme/mbe/images/linkedin.png"></a>
                  <a href="#"><img width="38" height="38" src="catalog/view/theme/mbe/images/twitter.png"></a>
                    <button class="btn btn-purple">+</button>
                </div>
            </div>
       </div>
    <!-- end newsletter -->
<script language="javascript">
function isValidEmailAddress(emailAddress) {
    var pattern = new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i);
    return pattern.test(emailAddress);
};
function email_subscribe(){
  if( !isValidEmailAddress( $("#subscribe_email").val() ) ) {
     alert("Email InValid");
  } else {
    $.ajax({
      type: 'post',
      url: 'index.php?route=module/newslettersubscribe/subscribe',
      dataType: 'html',
      data:$("#subscribe").serialize(),
      success: function (html) {
        alert("Subscribed Successfully");
      }});
  }
   
};



function email_unsubscribe(){
 
  $.ajax({
      type: 'post',
      url: 'index.php?route=module/newslettersubscribe/unsubscribe',
      dataType: 'html',
            data:$("#subscribe").serialize(),
      success: function (html) {
        eval(html);
      }}); 
}

   

</script>
